package com.zqu.controller;

import com.zqu.pojo.AdditionalProduct;
import com.zqu.service.AdditionalProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("additionnalproduct")
public class AdditionalProductController {
    @Autowired
    private AdditionalProductService additionalProductService;

    @RequestMapping("findadditionalproduct")
    @ResponseBody
    public AdditionalProduct selectById(){
        return additionalProductService.selectAdditionalProductById(1);
    }

    @RequestMapping("selectlist")
    @ResponseBody
    public List<AdditionalProduct> selectlist(){
        return additionalProductService.selectList(new AdditionalProduct());
    }

    @RequestMapping("insertadditionalproduct")
    @ResponseBody
    public boolean insert(){
        return additionalProductService.insertAdditionalProduct(new AdditionalProduct());
    }

    @RequestMapping("updateadditionalproduct")
    @ResponseBody
    public boolean update(){
        return additionalProductService.updateAdditionalProduct(new AdditionalProduct());
    }

    @RequestMapping("deleteadditionalproduct")
    @ResponseBody
    public boolean delete(){
        return additionalProductService.deleteAdditionalProduct(1);
    }

    @RequestMapping("deleteadditionalproductbyids")
    @ResponseBody
    public boolean deletebyids(){
        String[] ids = {"1","2"};
        return additionalProductService.deleteAdditionalProductByIds(ids);
    }
}
